package Test;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import DBLayer.*;
import ModelLayer.*;

public class TestDBSalgsVare {
	private DBSalgsVare dbSv;
	
	@Before
	public void setUp() throws Exception {
		dbSv = new DBSalgsVare();
	}

	@After
	public void tearDown() throws Exception {
	}
	
	

	
	
	//Findet et produkt id via et ID
	
	public void testSalgsVare() 
	{
		System.out.println("Printer 1 linje SalgsVareUd");
		SalgsVare svObject = dbSv.findSalgsVare(112, false);
		if(svObject != null)
		{
		
					System.out.println(svObject.getSalgsVare().getOrderId());
					System.out.println(svObject.getAntal());
					System.out.println(svObject.getProduktId().getProduktId());
					System.out.println("");
				
				
				
			
		}
		else {
			fail("Supplier not found");
		}
	}
	@Test
	public void testVisSalgsVare() 
	{
		int oId = 113;
		System.out.println("Printer SalgsVare Ud");
		ArrayList<SalgsVare> svObject = dbSv.visSalgsVare(oId, false);
		if(svObject != null)
		{
			int id = 0;
			while(svObject.size() > id)
			{
			
			System.out.println(svObject.get(0).getSalgsVare().getOrderId());
			System.out.println(svObject.get(0).getAntal());
			System.out.println(svObject.get(0).getProduktId().getProduktId());
			System.out.println("");
			id++;
			}
		}
		else {
			fail("Supplier not found");
		}
	
	}
}